﻿using AutoMapper.Internal.Mappers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Antiforgery;
using System.Collections.Generic;
using System.Threading.Tasks;

using ThridGroup.ERP.DTO;
using ThridGroup.ERP.HumanResources;
using Volo.Abp.ObjectMapping;

namespace ThridGroup.ERP.Web.Controllers.HumanResources
{
    [Route("HumanResources/[controller]/[action]")]
    [AutoValidateAntiforgeryToken]
    public class InterviewController : Controller
    {
        private readonly InterviewIService _interviewIService;
        private readonly IAntiforgery _antiforgery;

        public InterviewController(InterviewService interviewService, IAntiforgery antiforgery)
        {
            _interviewIService = interviewService;
            _antiforgery = antiforgery;
        }
        /// <summary>
        /// 面试管理
        /// </summary>
        /// <returns>返回任务</returns>
        public IActionResult InterviewList()
        {
            return View();
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="interview">实体</param>
        /// <returns>返回任务</returns>
        [HttpPost]
        public async Task<int> AddInterview([FromBody] InterviewDTO interview)
        {
            return await _interviewIService.AddInterview(interview);
        }
        /// <summary>
        /// 获取面试列表
        /// </summary>
        /// <returns>返回任务</returns>
        [HttpGet]
        public async Task<List<InterviewDTO>> GetInterview()
        {
            return await _interviewIService.GetInterview();
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="interviewId">主键</param>
        /// <returns>返回任务</returns>
        [HttpDelete]
        public async Task<int> DeleteInterview(int interviewId)
        {
            return await _interviewIService.DeleteInterview(interviewId);
        }
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="interview">实体</param>
        /// <returns>返回任务</returns>
        [HttpPost]
        public async Task<int> UpdateInterview([FromBody] InterviewDTO interview)
        {
            return await _interviewIService.UpdateInterview(interview);
        }
    }
}
